<template>
  <div class="w-full h-full flex flex-col">
    <div class="w-full flex h-10 items-center text-[--textColor] border-b mb-3">
      <span class="ml-5">wps编辑器</span>
    </div>
    <div class="w-full flex-1 px-5 pb-5 box-border overflow-y-auto">
     <wps-text :key="1" :wpsUrl="wpsUrlData"></wps-text>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref, watch } from "vue";
import wpsViwe from "@/components/wps/index.vue";
import {_getWpsCreateTemplateFile} from '@/api/const/index'
import local from "@/utils/local";
import { ElMessage } from 'element-plus'

export default defineComponent({
  components: {
    "wps-text": wpsViwe,
  },
  setup() {
    const file_id = ref();
    const wpsUrlData = ref();
    const getWpsCreateTemplateFile=async()=>{
        const res:any=await _getWpsCreateTemplateFile(local.get('tokenObj')?.token)
        console.log(res);
        if(res.code==10000){
             wpsUrlData.value=res.data.redirect_url
             file_id.value=res.data.file_id
        }else{
            ElMessage.error(res.message)
        }
       
    }
    onMounted(()=>{
        getWpsCreateTemplateFile()
    })
    return {
      wpsUrlData,
      file_id
    };
  },
});
</script>

<style scoped></style>
